//
//  ExperienceVoucherManagerTableViewController.m
//  GoodWayClient
//
//  Created by HuiDong on 15/12/3.
//  Copyright © 2015年 HuiDong. All rights reserved.
//

#import "ExperienceVoucherManagerTableViewController.h"
#import "ExperienceVoucherTableViewCell.h"
#import "ShowMore.h"

@interface ExperienceVoucherManagerTableViewController ()

@property (nonatomic, strong)NSArray *array;
@property (nonatomic, strong)NSMutableArray *array1;

@end

@implementation ExperienceVoucherManagerTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //footView的加载更多的显示
    ShowMore *showMore = [ShowMore footView];
    
    __weak ExperienceVoucherManagerTableViewController *tempController = self;
    
    ShowMoreBlock block = ^{
        [tempController.array1 addObjectsFromArray:tempController.array];
        [tempController.tableView reloadData];
    };
    
    showMore.block = block;
    self.tableView.tableFooterView = showMore;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//懒加载
-(NSArray *)array
{
    if (!_array) {
        _array = @[@{@"name":@"NJ-88-0001",@"event":@"享受一次除碳服务",@"time":@"2015-12-31"},@{@"name":@"NJ-88-0001",@"event":@"享受一次除碳服务",@"time":@"2015-12-31"},@{@"name":@"NJ-88-0001",@"event":@"享受一次除碳服务",@"time":@"2015-12-31"},@{@"name":@"NJ-88-0001",@"event":@"享受一次除碳服务",@"time":@"2015-12-31"}];
    }
    return _array;
}
-(NSMutableArray *)array1
{
    if (!_array1) {
        _array1 = [NSMutableArray arrayWithArray:self.array];
    }
    return _array1;
}

//数据源方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.array1.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ExperienceVoucherTableViewCell *cell = [ExperienceVoucherTableViewCell ExperienceVoucherWithTableView:tableView];
    cell.dic = self.array1[indexPath.row];
    return cell;
}

//行高
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 80;
}

@end
